// 渲染函数的实现

function render(vnode,container){
    let el = document.createElement(vnode.tag);
    for(const key in vnode.props){
        if(/^on/.test(key)){ 
         el.addEventListener(
            key.substr(2).toLowerCase(),
            vnode.props[key]
         )
        }
        // console.log(vnode.props[key],'=====')
    }

    console.log(typeof vnode.children,'typeof vnode.children')
    if(typeof vnode.children == 'string'){
        el.createTextNode = vnode.children
    }else if(typeof vnode.children == 'Object'){
        vnode.children.forEach(item=>{
            render(item, el)
        })
    }    
    container.appendChild(el)
}

